package com.leil.java8.递归;

public class RecursiveFactorial {

    // 静态变量
    static IntCall fact;

    public static void main(String[] args) {
        // 使用lambda表达式定义阶乘
        fact = n -> n == 0 ? 1 : n * fact.call(n - 1);

        for (int n = 0; n < 10; n++) {
            System.out.println(fact.call(n));
        }
    }

}
